From: Julien Grall Date: Mon, 10 Mar 2014 13:40:50 +0000 (+0100) Subject: xmalloc: handle correctly page allocation when align > size X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5495 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=ac2cba2901779f66bbfab298faa15c956e91393a;p=xen.git xmalloc: handle correctly page allocation when align > size When align is superior to size, we need to retrieve the order from align during multiple page allocation. I guess it was the goal of the commit fb034f42 "xmalloc: make close-to-PAGE_SIZE allocations more efficient". Signed-off-by: Julien Grall Acked-by: Keir Fraser --- diff --git a/xen/common/xmalloc_tlsf.c b/xen/common/xmalloc_tlsf.c index d3bdfa7d57..a5769c9d3e 100644 --- a/xen/common/xmalloc_tlsf.c +++ b/xen/common/xmalloc_tlsf.c @@ -527,11 +527,10 @@ static void xmalloc_pool_put(void *p) static void *xmalloc_whole_pages(unsigned long size, unsigned long align) { - unsigned int i, order = get_order_from_bytes(size); + unsigned int i, order; void *res, *p; - if ( align > size ) - get_order_from_bytes(align); + order = get_order_from_bytes(max(align, size)); res = alloc_xenheap_pages(order, 0); if ( res == NULL )